package com.shigen.shop.exception;

import com.shigen.shop.enums.BizCodeEnum;

/**
 * 业务异常类
 *
 * @author shigenfu
 * @date 2022/7/25 11:20 下午
 */
public class BizException extends RuntimeException {

  private static final long serialVersionUID = -5103876456037174406L;
  private String code;

  public BizException(String code, String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
    super(message, cause, enableSuppression, writableStackTrace);
    this.code = code;
  }


  public BizException(String code, String message) {
    super(message);
    this.code = code;
  }

  public BizException(BizCodeEnum bizCodeEnum) {
    super(bizCodeEnum.getMsg());
    this.code = String.valueOf(bizCodeEnum.getCode());
  }

  public BizException(String message) {
    super(message);
  }

  public String getCode() {
    return this.code;
  }

  public void setCode(String code) {
    this.code = code;
  }
}

